<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
</head>
<s:head/>
<script type="text/javascript">
    var toCompanys = new Array();
    $.ajax({
        url: "company-listCompany",
        method: "post",
        async: false,
        success: function (data) {
            $.each(data.companys, function (index, element) {
                var companyOption = new Array();
                companyOption.push(element.name);
                companyOption.push(element.id);
                toCompanys.push(companyOption);
            });
        }
    });
    var state = $.mrdForm.ajaxdp("dropdown-useState");
    var formSetting = {
        title: "${systemValue.chn}业务流转设置",
        module: "save",
        columns: [
            {
                name: "sysBizAuto.toCompany.id",
                label: "接收公司",
                type: "dropdown",
                data: toCompanys,
                minLength: 0,
                validate: "validate[required]"
            }, {
                name: "sysBizAuto.state",
                label: "启用状态",
                type: "dropdown",
                data: state,
                minLength: 0,
                validate: "validate[required]"
            }
        ], form: {
            'url': "sysBizAuto-saveOrUpdateSysBizAuto?sysBizAuto.systemValue.identifier=${sysBizAuto.systemValue.identifier}",
            'ajaxForm': {
                success: function (data) {
                    alert(data.msg);
                }
            }
        }

    };

    $(
            function () {
                var options = {
                    //提交方式
                    type: "POST",
                    //提交数据格式
                    dataType: "json",
                    //在提交之前做的操作
                    beforeSubmit: function () {
                        return $("#mrdForm").validationEngine("validate");
                    },
                    //成功后做的操作
                    success: function (responseText, statusText, xhr, $form) {
                        alert(responseText.msg);
                    }
                };
                $('#mrdForm').ajaxForm(options);
                $("#mrdForm").mrdForm(formSetting);
            }
    );
</script>
<body>
<div id="mrdForm">
</div>
</body>
</html>
